//package com.boot2.core.web;
//
//import javax.servlet.ReadListener;
//import javax.servlet.ServletInputStream;
//import java.io.ByteArrayInputStream;
//import java.io.IOException;
//
//public class BufferedServletInputStream extends ServletInputStream {
//    private ByteArrayInputStream inputStream;
//    public BufferedServletInputStream(byte[] buffer) {
//        this.inputStream = new ByteArrayInputStream( buffer );
//    }
//    @Override
//    public int available() throws IOException {
//        return inputStream.available();
//    }
//    @Override
//    public int read() throws IOException {
//        return inputStream.read();
//    }
//    @Override
//    public int read(byte[] b, int off, int len) throws IOException {
//        return inputStream.read( b, off, len );
//    }
//
//    /**
//     * Has the end of this InputStream been reached?
//     *
//     * @return <code>true</code> if all the data has been read from the stream,
//     * else <code>false</code>
//     * @since Servlet 3.1
//     */
//    @Override
//    public boolean isFinished() {
//        return false;
//    }
//
//    /**
//     * Can data be read from this InputStream without blocking?
//     * Returns  If this method is called and returns false, the container will
//     * invoke {@link ReadListener#onDataAvailable()} when data is available.
//     *
//     * @return <code>true</code> if data can be read without blocking, else
//     * <code>false</code>
//     * @since Servlet 3.1
//     */
//    @Override
//    public boolean isReady() {
//        return false;
//    }
//
//    /**
//     * Sets the {@link ReadListener} for this {@link ServletInputStream} and
//     * thereby switches to non-blocking IO. It is only valid to switch to
//     * non-blocking IO within async processing or HTTP upgrade processing.
//     *
//     * @param listener The non-blocking IO read listener
//     * @throws IllegalStateException If this method is called if neither
//     *                               async nor HTTP upgrade is in progress or
//     *                               if the {@link ReadListener} has already
//     *                               been set
//     * @throws NullPointerException  If listener is null
//     * @since Servlet 3.1
//     */
//    @Override
//    public void setReadListener(ReadListener listener) {
//
//    }
//}